/**
 * ...
 * >author		João Vítor de Souza
 */

package com.cupcakeengine.core 
{
	
	import com.cupcakeengine.display.GameObject;	
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.DisplayObject;
	import flash.display.DisplayObjectContainer;
	import flash.display.InteractiveObject;
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.events.EventDispatcher;		

	public class ObjectFactory extends EventDispatcher 
	{
		// ___________________________________________________________________ CONSTANTS
		
		// ___________________________________________________________________ CLASS PROPERTIES
		
		// ___________________________________________________________________ INSTANCE PROPERTIES
		
		private static var _instance	: ObjectFactory;
		
		// ___________________________________________________________________ GETTERS AND SETTERS
		
		// ___________________________________________________________________ CONSTRUCTOR
		
		public function ObjectFactory (singleton:SingletonObligate) {}
		
		// ___________________________________________________________________ PUBLIC METHODS
		
		public static function getInstance () : ObjectFactory
		{
			if (!ObjectFactory._instance) ObjectFactory._instance = new ObjectFactory(new SingletonObligate());
			return ObjectFactory(ObjectFactory._instance);
		}		
		
		public function getGameObject(display:DisplayObject, align:String, isTransparent:Boolean, bitmapDataObject:Object, bitmapObject:Object):GameObject
		{			
			return new GameObject(BitmapFactory.getInstance().getBitmapObject(display, align, isTransparent, bitmapDataObject, bitmapObject));
		}
		
		// ___________________________________________________________________ PRIVATE METHODS
		
		
		//private function getDisplayObject(display:DisplayObject, align:String, isInteractive:Boolean, useBitmap:Boolean, bitmapDataObject:Object, bitmapObject:Object):DisplayObject
		//{			
			//if (!isInteractive) {
				//if (useBitmap){
					//display = BitmapFactory.getInstance().getBitmap(display, align, bitmapDataObject, bitmapObject);
				//} else {
					//if (display is DisplayObjectContainer)
					//DisplayObjectContainer(display).mouseChildren = false;
					//if (display is InteractiveObject)
					//DisplayObjectContainer(display).mouseEnabled = false;
				//}
			//}
			//
			//return display;
		//}		
		
		// ___________________________________________________________________ EVENTS
	}
}

class SingletonObligate {}
